<!DOCTYPE html >
<html>
<head>
<meta name="Generator" content="tpshop" />
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width">
<title>{$goods.goods_name}_{$tpshop_config.shop_info_store_title}</title>
<meta http-equiv="keywords" content="{$tpshop_config['shop_info_store_keyword']}" />
<meta name="description" content="{$tpshop_config['shop_info_store_desc']}" />
<meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=0"/>
<include file="Public/meta"/>
<link rel="stylesheet" type="text/css" href="__STATIC__/css/public.css"/>
<link rel="stylesheet" type="text/css" href="__STATIC__/css/goods.css"/>
<link rel="stylesheet" type="text/css" href="__STATIC__/css/layer.css"/>
<script type="text/javascript" src="__STATIC__/js/jquery.js"></script>
<script type="text/javascript" src="__STATIC__/js/touchslider.dev.js"></script>
<script type="text/javascript" src="__STATIC__/js/layer.js" ></script>
<script src="__PUBLIC__/js/global.js"></script>
<script src="__PUBLIC__/js/mobile_common.js"></script>
<script src="__STATIC__/js/common.js"></script>
</head>
<body> 
  <div class="main" id="user_goods_ka_1" style="display:block;">
<div class="banner">
  <div id="slider" class="slider" style="overflow: hidden; visibility: visible; list-style: none; position: relative;">
    <ul id="sliderlist" class="sliderlist" style="position: relative; overflow: hidden; transition: left 600ms ease; -webkit-transition: left 600ms ease;">
    
      	<li style="float: left; display: block; width: 100%;"><span><a  href="javascript:void(0)"><img title="" width="100%" src="{$goods.original_img}"></a></span></li>
        
       <foreach  name="goods_images_list" item="pic">
      	<li style="float: left; display: block; width: 100%;"><span><a  href="javascript:void(0)">
      	<img title="" width="100%" src="{$pic.image_url}"></a></span></li>
       </foreach>
    </ul>
    <div id="pagenavi">
    <foreach  name="goods_images_list" item="pic" key="k">
    	<a href="javascript:void(0);" <if condition="$k eq 0">class="active"</if>></a>
     </foreach>
	</div>
  </div>
</div>
<div class="s_bottom"></div>
<script type="text/javascript">$(function(){
	$("div.module_special .wrap .major ul.list li:last-child").addClass("remove_bottom_line");
});
var active=0,
	as=document.getElementById('pagenavi').getElementsByTagName('a');
	
for(var i=0;i<as.length;i++){
	(function(){
		var j=i;
		as[i].onclick=function(){
			t2.slide(j);
			return false;
		}
	})();
}
var t2=new TouchSlider({id:'sliderlist', speed:600, timeout:6000, before:function(index){
		as[active].className='';
		active=index;
		as[active].className='active';
	}});
</script>
	  <form name="buy_goods_form" method="post" id="buy_goods_form" >
      <div class="product_info nomrb">
        <h2>{$goods.goods_name}</h2>
        
        
   
    
    
<if condition="$filter_spec">  

    <foreach item="spec" key="key" name="filter_spec">
    <div id="filter_spec_box">   
          <!-- 属性标题 -->
          <div class="item">
          <span style="float:left;">{$key}：&nbsp;&nbsp;</span>
          <foreach name="spec" item="v2" key="k2">
	          <a href="javascript:;" onclick="switch_spec(this);" title="{$v2[item]}" <if condition="$k2 eq 0">class="hover"</if>>
	          	<input type="radio" style="display:none;" name="goods_spec[{$key}]" value="{$v2[item_id]}" <if condition="$k2 eq 0 ">checked="checked"</if>/>
          		{$v2[item]}
          	  </a>
           </foreach>
          </div>                    
    </div>
    </foreach>
     <div style="clear:both;"></div>
</if>



        <dl class="goods_price">
          <script type="text/javascript" src="__STATIC__/js/lefttime.js"></script>
          <dt> <span id="goods_price">￥{$goods.shop_price}</span>
              <!--<font>市场价：￥{$goods.market_price}</font> -->
          </dt>
        </dl>
        <!-- 课程显示 -->
        </div>


          <if condition="$goods[extend_cat_id] eq 52">
              <div class="Wallet">
                  <dl class="b"><dt><i class="icon iconfont icon-juzhong"></i>课程类别：{$goods.coach_cate_id|get_coach_cate_name}</dt></dl>
                  <if condition="!$filter_spec">
                      <dl class="b"><dt><i class="icon iconfont icon-liebiao"></i>课程数量：{$goods.kc_num}节课时</dt></dl>
                  </if>
              </div>

              <elseif condition="$goods[extend_cat_id] eq 53"/>

              <div class="Wallet">
                  <dl class="b"><dt><i class="icon iconfont icon-calendar"></i>截止时间：{$goods.kc_end_date}</dt></dl>
              </div>

          </if>



         <div class="product_info">
        <if condition="$goods.goods_content neq ''">
        <div class="desc_content">商品描述</div>
        <div class="desc_font13">
        	{$goods.goods_content|htmlspecialchars_decode}
        </div>
        </if>
      </div>   

      <section id="search_ka" style="display:none;">
                  <button type="button" class="decrease" onClick="goods_cut();">-</button>
                    <input type="text" class="num" id="number" name="goods_num" value="1" min="1" max="1000"/>
                    <input type="hidden" name="goods_id" value="{$goods.goods_id}"/>
                  <button type="button" class="increase" onClick="goods_add();">+</button>
               
      </section>
      

<script type="text/jscript">
function click_search (){
  var search_ka = document.getElementById("search_ka");
  	if (search_ka.className == "s-buy open ui-section-box"){
	  	search_ka.className = "s-buy ui-section-box";
	}else {
		search_ka.className = "s-buy open ui-section-box";
	}
}
 
function changeAtt(t) {
	t.lastChild.checked='checked';
	for (var i = 0; i<t.parentNode.childNodes.length;i++) {
	    if (t.parentNode.childNodes[i].className == 'hover') {
	        t.parentNode.childNodes[i].className = '';
			t.childNodes[0].checked="checked";
		}
	}
	t.className = "hover";
	changePrice();
}

function changeAtt1(t) {
	t.lastChild.checked='checked';
	for (var i = 0; i<t.parentNode.childNodes.length;i++) {
	    if (t.className == 'hover') {
	           t.className = '';
			t.childNodes[0].checked = false;
		}
		else{
			t.className="hover";
			t.childNodes[0].checked = true;
		}
	}
	changePrice();
}

	function goods_cut(){
  		var num_val=document.getElementById('number');  
  		var new_num=num_val.value;  
  		var Num = parseInt(new_num);  
  		if(Num>1)Num=Num-1;  
  		num_val.value=Num;
  	}  
  	function goods_add(){
  		var num_val=document.getElementById('number'); 
  		var new_num=num_val.value;  
  		var Num = parseInt(new_num);  
  		Num=Num+1;  num_val.value=Num;
  	} 
</script>
      <div style=" height:8px; background:#eeeeee; margin-top:-1px;"></div>
     
    </form>
  </div>


<div class="footer_nav">
  <dl>
    <dd class="goumai"><a style="display:block;" href="javascript:void(0);"  onclick="AjaxAddCart({$goods.goods_id},1,1);"><i class="icon iconfont icon-gouwuche fontshop"></i>立即购买</a> </dd>
  </dl>
</div>
<script type="text/javascript">

$(document).ready(function(){	
	// 更新商品价格
	get_goods_price();
});

function switch_spec(spec)
{
    $(spec).siblings().removeClass('hover');
    $(spec).addClass('hover');
	$(spec).siblings().children('input').prop('checked',false);
	$(spec).children('input').prop('checked',true);	
    //更新商品价格
    get_goods_price();
}

function get_goods_price()
{
	var goods_price = {$goods.shop_price}; // 商品起始价
	var store_count = {$goods.store_count}; // 商品起始库存	
	var spec_goods_price = {$spec_goods_price};  // 规格 对应 价格 库存表   //alert(spec_goods_price['28_100']['price']);	
	// 如果有属性选择项
	if(spec_goods_price != null)
	{
		goods_spec_arr = new Array();
		$("input[name^='goods_spec']:checked").each(function(){
			 goods_spec_arr.push($(this).val());
		});    
		var spec_key = goods_spec_arr.sort(sortNumber).join('_');  //排序后组合成 key	
		goods_price = spec_goods_price[spec_key]['price']; // 找到对应规格的价格		
		store_count = spec_goods_price[spec_key]['store_count']; // 找到对应规格的库存
	}
	var goods_num = parseInt($("#goods_num").val()); 
	// 库存不足的情况
	if(goods_num > store_count)
	{
	   goods_num = store_count;
	   alert('库存仅剩 '+store_count+' 件');
	   $("#goods_num").val(goods_num);
	}
    var flash_sale_price = parseFloat("{$goods['flash_sale']['price']}");
    (flash_sale_price > 0) && (goods_price = flash_sale_price);
	$("#goods_price").html('￥'+goods_price+'元'); // 变动价格显示

}

function sortNumber(a,b) 
{ 
	return a - b; 
} 

</script>
<script src="__PUBLIC__/js/jqueryUrlGet.js"></script><!--获取get参数插件-->
<script> set_first_leader(); //设置推荐人 </script>
<include file="Public/footer_nav"/>
</body>
</html>